import React,{Component} from 'react';
import {
    View,
    Text,
    StyleSheet,
    TouchableOpacity,
    Image,
    TextInput,
} from 'react-native';
import Util from './util'
import Icon from 'react-native-vector-icons/Ionicons'
export default class header extends Component{
    constructor(props) {
      super(props);
      this.state = {};
    }

    _pop(){
        this.props.navigation.pop()
    }

    render(){
        let hideBack = this.props.hideBack
        return(
            <View style={styles.header}>
                {
                    !hideBack?
                        <TouchableOpacity
                            onPress={()=>this._pop()}
                            style={styles.btn_view}>
                            <Icon name={'ios-arrow-back'} size={20}/>
                        </TouchableOpacity>:
                        <View style={styles.btn_view}>
                        </View>
                }
                <View style={styles.title_view}>
                    <Text>{this.props.title}</Text>
                </View>
                <View style={styles.btn_view} />
            </View>
        )
    }
}
var styles = StyleSheet.create({
    header:{
        width:Util.size.width,
        height:40,
        backgroundColor:"#fff",
        flexDirection:'row',
        alignItems:'center',
        justifyContent:'center',
        borderBottomWidth:1,
        borderBottomColor:"#e0e0e0"
    },
    btn_view:{
        width:40,
        height:40,
        alignItems:'center',
        justifyContent:'center'
    },
    title_view:{
        flex:1,
        alignItems:'center',
        justifyContent:'center'
    }
})